Skip to content

feat: python plugin compat#79

Draft
tedhabeck wants to merge 4 commits into
devfrom
feat/python_plugin_compat
Draft

feat: python plugin compat#79
tedhabeck wants to merge 4 commits into
devfrom
feat/python_plugin_compat

Conversation

@tedhabeck

@tedhabeck tedhabeck commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes: #20

Changes

Adds crates/cpex-hosts-python — a new Rust crate that lets the Rust PluginManager host Python plugins via subprocess isolation, rather than requiring a Python host process.

Key pieces:

  • cpex-hosts-python crate — drives Python plugin classes over the same JSON-lines stdin/stdout protocol that worker.py uses. Manages venv creation/caching, subprocess lifecycle, and hook dispatch from Rust.
  • IsolatedPythonPluginAdapter — a Plugin + AnyHookHandler impl that wraps one Python class in a dedicated worker subprocess.
  • VenvManager — creates and caches per-plugin virtual environments from a requirements.txt.
  • WorkerProcess — manages the worker.py subprocess lifecycle (spawn, send, recv, restart on failure).
  • Python-side fixes (cpex/framework/base.py, isolated/worker.py):
    • HookRef now resolves namespaced hooks like cmf.tool_pre_invoke by falling back to the bare name tool_pre_invoke, so convention-named plugin methods work with CMF-namespaced hooks.
    • worker.py normalizes namespaced hook names the same way, and preserves request_id in unexpected error responses.

Checks

  • make lint passes
  • make test passes
  • CHANGELOG updated (if user-facing)

…stale one is not used.

doc: isolated worker implementation plan

Signed-off-by: habeck <habeck@us.ibm.com>
Signed-off-by: habeck <habeck@us.ibm.com>
Signed-off-by: habeck <habeck@us.ibm.com>
@tedhabeck tedhabeck changed the title Feat/python plugin compat feat: python plugin compat Jun 23, 2026
…equires the plugin to be installed before the test will pass)

Signed-off-by: habeck <habeck@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant